/*
package com.lazy.utils.redis;

import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.ClusterServersConfig;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.stream.Stream;

*/
/**
 * @author: wql
 * @create_time: 2018-02-05 16:00
 * @describe: redisson 配置
 *//*

@Configuration
public class RedissonConfig {

    @Value("${redis.default.hosts}")
    private String[] hosts;
    @Value("${redis.default.password}")
    private String password;
    @Value("${redis.default.connectionTimeout}")
    private int connectionTimeout;


    @Bean(destroyMethod = "shutdown")
    public RedissonClient redissonClient() {
        Config config = new Config();
        ClusterServersConfig clusterServersConfig =
                config.useClusterServers();
        clusterServersConfig.
                addNodeAddress(Stream.of(hosts).map((node) -> "redis://" + node).toArray(String[]::new)).
                setConnectTimeout(connectionTimeout);
        if (StringUtils.isNotBlank(password)) {
            clusterServersConfig.setPassword(password);
        }
        return Redisson.create(config);
    }


}
*/
